app.controller("loginCtrl", function ($scope, $http) {
    $scope.userId = "yawn";
    $scope.password = "123456";

    $scope.login = function () {
        $http.post(
            "/login",
            {
                "userId": $scope.userId,
                "password": $scope.password
            }
        ).then(
            function (res) {
                if (res.data.code === 1) {
                    window.location = "/index";
                } else {
                    alert(res.data.msg);
                }
            },
            function () {
                alert("网络错误，请稍后再试！");
            }
        );
    };

});